/**
 * 
 */
package design_pattern.interpreter;

/**
 * @author linzq
 * 
 */
public class Client {

  /**
   * @param args
   */
  public static void main(String[] args) {
    Context ctx = new Context();
    Expression exp;
    Variable x = new Variable("x");
    Variable y = new Variable("y");
    Constant c = new Constant(true);
    ctx.asign(x, false);
    ctx.asign(y, false);
    exp = new OR(new And(c, x), new And(c, y));
    System.out.println("x=" + x.interpret(ctx));
    System.out.println("y=" + y.interpret(ctx));
    System.out.println(exp.toString() + " = " + exp.interpret(ctx));
  }

}
